import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper_view/flutter_swiper_view.dart';
import 'package:hook_rent/widgets/image_widget.dart';

class SwiperWidget extends StatelessWidget {
  final List<String> images = [
    'https://img.zcool.cn/community/01ccc55841176fa8012060c875ce56.png@1280w_1l_2o_100sh.png',
    'https://www.aluco-bond.cn/d/file/content/2021/10/616e18df426bb.jpg',
    'https://pic.nximg.cn/file/20210527/30789053_145604231122_2.jpg'
  ];
  SwiperWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 212.h,
      child: Swiper(
        itemBuilder: (context, index) {
          return ImageWidget(
            images[index],
            fit: BoxFit.fill, // 填充模式
          );
        },
        indicatorLayout: PageIndicatorLayout.COLOR,
        autoplay: true,
        itemCount: images.length,
        pagination: const SwiperPagination(),
      ),
    );
  }
}
